!************************************************************
! this subrouitne calculate properties just downstream of
! shock in isentropic supersonic flow
! ref. to Eq. 7.90~7.92 in Gas Dynamics of Zrcrow and Hoffman
!************************************************************
! Created by : B. G.
! Date       : 2015-08-13
! Revised    :
!************************************************************
! Nomenclature: 
!   sine~sinb	temporary variables used in equations
!   beta   	   shock angle
!   
!************************************************************
! Warning :
!   1. angle in rad, not degree
!************************************************************

subroutine Shock()
   use VariableDef
   implicit none
   ! given variables
   ! real*8::eps4,Mu,Vuu,pu,rhou
   ! temporary variables
   real*8::sine,tane,mn,tanb,sinb
   real*8::beta
   ! calculate variables
   ! real*8::theta4,p4,rho4,V4
   
   sine=sin(eps4)
   tane=tan(eps4)
   mn=(Mu*sine)**2
   ! determine beta
   tanb=tane*2*(1/mn+(g-1)/2)/(g+1)
   beta=atan(tanb)
   
   sinb=sin(beta)
   ! determine theta4
   theta4=eps4-beta
   ! determine V4, p4 and rho4
   V4=Vuu*sine*(2/(g+1)/mn+(g-1)/(g+1))/sinb
   p4=pu*2*g*(mn-(g-1)/2/g)/(g+1)
   rho4=rhou*tane/tanb
   
end subroutine Shock
